Make Resource Unique
The book has now been published and the content of this chapter has likely changed substanstially.Several tests are accidentally creating or using the same resource in a Shared Fixture.
Make the name of any resources used by a test unique.
From [RTC].
A lot of problems originate from the use of overlapping resource names, either between different tests run by the same user or between simultaneous test runs done by different users.
Such problems can easily be prevented (or repaired) by using unique identifiers for all resources that are allocated, for example by including a time-stamp. When you also include the name of the test responsible for allocating the resource in this identifier, you will have less problems finding tests that do not properly release their resources.
Implementation Notes
We make the name of any resources used by a test unique across all tests by using a Distinct Generated Value (see Generated Value on page X) as part of the name. Ideally, the name should include the name of the test that "owns" the resource. To avoid self-Interacting Tests (see Erratic Test on page X), include a time-stamp in the name of any resources the tests create and use Automated Teardown (page X) to delete the resources at the end of the test.
Copyright © 2003-2008 Gerard Meszaros all rights reserved